﻿//文件指定编译编码UTF-8
#pragma execution_character_set("utf-8")

/**
*
* @file:    user.h
* @brief:
* @author:  sanshi522@163.com
* @date:    2024-11-05  11:38
*
*
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License along
*  with this program; if not, write to the Free Software Foundation, Inc.,
*  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/

#ifndef USER_H
#define USER_H
#include "qbaseentity.h"

//============状态定义
#define USER_STATUS_DISABLED 1 //禁用的
#define USER_STATUS_ENABLED 2 //启用的
#define USER_STATUS_DELETED 3 //删除的

/**
 * @brief 用户实体类
 */
class User : public QBaseEntity
{
    Q_OBJECT
    // 使用 Q_PROPERTY 宏定义属性
    Q_PROPERTY(uint64_t id READ getId WRITE setId)
    Q_PROPERTY(QString password READ getPassword WRITE setPassword)
    Q_PROPERTY(QString realName READ getRealName WRITE setRealName)
    Q_PROPERTY(QString username READ getUsername WRITE setUsername)
    Q_PROPERTY(QString gender READ getGender WRITE setGender)
    Q_PROPERTY(QStringList roles READ getRoles WRITE setRoles)
    Q_PROPERTY(int status READ getStatus WRITE setStatus)
public:
    User(QObject *parent = nullptr);
//    User(const User &other);// 自定义拷贝构造函数
//    User& operator=(const User &other);// 自定义拷贝构造函数
    ~User();
    uint64_t getId() const;
    void setId(const uint64_t &value);

    QString getPassword() const;
    void setPassword(const QString &value);

    QString getRealName() const;
    void setRealName(const QString &value);

    QString getUsername() const;
    void setUsername(const QString &value);

    QString getGender() const;
    void setGender(const QString &value);

    QStringList getRoles() const;
    void setRoles(const QStringList &value);

    int getStatus() const;
    void setStatus(int value);

private:
    uint64_t id;
    QString password;
    QString realName;
    QString username;
    QString gender;//性别
    QStringList roles;
    int status;//状态
};

// 声明元类型
Q_DECLARE_METATYPE(uint64_t)

#endif // USER_H
